﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HtmlAgilityPack;
using System.Net;

namespace Taurus.Platform.Net
{
    /// <summary>
    /// 负责HtmlWeb的创建
    /// 2009-12-15 
    /// 吴鸣震
    /// </summary>
    class HtmlWebBuilder
    {
        private string _email;
        private HtmlWeb _web;


        public HtmlWeb BulidHtmlWeb(string email)
        {
            _email = email;
            _web = new HtmlWeb();

            _web.PreRequest = new HtmlWeb.PreRequestHandler(PreRequest);
            return _web;
        }

        private bool PreRequest(HttpWebRequest request)
        {
            request.CookieContainer = CookieContainerManager.GetCookieContainer(_email);
            return true;
        }
    }
}
